/**
 * Copyright(c) 2013 Jade Techonologies, Ltd.
 *
 * History:
 *   2011-5-25 18:23:14 Created by sky
 */
package com.jade.bss.base.customer;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 客户和应用中用户的映射关系。
 *
 * @author sky
 * @version 1.0 2011-5-25 18:23:14
 */
@Entity
@Table (name = "BSS_USER_MAPPING")
public class UserMapping
        implements Serializable
{
    /** customer identifier */
    @Id
    @Column (name = "customer_id")
    private long customerId;

    /** application code */
    @Id
    @Column (name = "app_code")
    private String appCode;

    public UserMapping()
    {
    }

    /** user identifier */
    @Column (name = "user_id")
    private String userId;

    public UserMapping(long customerId, String appCode)
    {
        this.appCode = appCode;
        this.customerId = customerId;
    }

    public String getAppCode()
    {
        return appCode;
    }

    public void setAppCode(String appCode)
    {
        this.appCode = appCode;
    }

    public long getCustomerId()
    {
        return customerId;
    }

    public void setCustomerId(long customerId)
    {
        this.customerId = customerId;
    }

    public String getUserId()
    {
        return userId;
    }

    public void setUserId(String userId)
    {
        this.userId = userId;
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        UserMapping that = (UserMapping) o;

        if (customerId != that.customerId) {
            return false;
        }
        if (!appCode.equals(that.appCode)) {
            return false;
        }
        if (!userId.equals(that.userId)) {
            return false;
        }

        return true;
    }
}
